#!/bin/sh

FILES=$(find ".hx" . | grep -e ".hx$")

for f in $FILES
do
  echo $f
  sed -i 's/ *public class/class/g;s/public \+interface/interface/;s/private//g;s/protected//g;s/const/inline/g;s/implements/, implements/g' $f # remove private/protected/const
  #CLASS=$(grep class $f | sed "s@class \([a-zA-Z]\+\) extends.*@\1@;s/ *\([A-Za-z]\+\) */\1/") # get class
  #CLASS=grep class $f | sed 's/class  *\([A-Za-z]\+\) */\1/g'
  #CLASS=grep class $f | sed 's/class \?\([A-Za-z]\+\) .*$/\1/g'
  #echo $CLASS: "s/function \+$CLASS/function new/"
  #sed -i "s/function \+$CLASS/function new/" $f ## WARNING: not safe at all
done
